//
//  RootViewController.m
//  UI8_UITableView课堂练习
//
//  Created by dllo on 15/11/18.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "RootViewController.h"

@interface RootViewController ()<UITableViewDataSource, UITableViewDelegate>

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    UITableView *tableV = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    
    tableV.delegate = self;
    tableV.dataSource = self;
    
    [self.view addSubview:tableV];
    [tableV release];
    
    
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 100;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *cellStr = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellStr];

    if (nil == cell) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellStr] autorelease];
    }
    if (0 == indexPath.row) {
        cell.textLabel.text = @"张三";
        cell.detailTextLabel.text = @"🐷";
        cell.imageView.image = [UIImage imageNamed:@"image.png"];
        return cell;
    }
    if (1 == indexPath.row) {
        cell.textLabel.text = @"李四";
        cell.detailTextLabel.text = @"🐷";
        cell.imageView.image = [UIImage imageNamed:@"image.png"];
        cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
        return cell;
    }
    if (2 == indexPath.row) {
        cell.textLabel.text = @"王五";
        cell.detailTextLabel.text = @"🐷";
        cell.imageView.image = [UIImage imageNamed:@"image.png"];
        cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
        return cell;
    }
    if (3 == indexPath.row) {
        cell.textLabel.text = @"赵六";
        cell.detailTextLabel.text = @"🐷";
        cell.imageView.image = [UIImage imageNamed:@"image.png"];
        cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
        return cell;
    }
    
    return cell;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
